<template>
    <div>
        <div id="pdfDom" ref="pdfDom">
        <div style="width:100%;background-color:#fff;box-sizing: border-box;padding:0 56px;">
            <div class="page">
                <div class="pdfTitle" >成都市佳颖医用制品有限公司</div>
                <div class="pdfTitle" >{{taskcode}}检验记录列表</div>
                <div  class="pdfContent">
                    <table  border="1" cellspacing="0" cellpadding="0" bordercolor="#000000" class="myTable">
                        <tr>
                            <th class="text-center">检验名称</th>
                            <th class="text-center">检验项</th>
                            <th class="text-center width100">是否合格</th>
                        </tr>
                        <tr v-for="item in checkRecordList" :key="item.id" >
                            <td class="text-center">{{item.name}}</td>
                            <td>
                                <div v-for="(val,index) in item.jqChecks" :key="val.name+index">
                                    <span class="checkTitle">{{val.name}}:</span>
                                    <span v-if="val.type==='1'" class="checkContent">
                                        {{val.reference===""?(val.value==="1"?"是":"否"):(val.value==="1"?val.reference:"否")}}
                                    </span>
                                    <span v-else class="checkContent">{{val.value}}</span>
                                </div>
                            </td>
                            <td class="text-center width100">{{item.state===1?"合格":(item.state===0?"不合格":"")}}</td>
                        </tr>
                    </table>
                </div>
            </div>
        </div>
    </div>
    </div>
</template>
<script>
import cgbHttp from '@/axios/cgbHttp.js'
export default {
    name:'checkRecordList',
    props:{
        checkRecordList:{
            type:Array,
            required:true
        },
        taskcode:{
            type:String
        }
    },
    data(){
        return {}
    },
    methods:{
        getCgPdfData(id){
            let self = this;
            let nowDate = new Date();
            let total=0;
             self.$print(self.$refs.pdfDom);
        },
         alterData(arr, n) {
            //重构data数据（数组一维变二维）
            let self = this,
                Arr = arr != null ? arr : [],
                len = Arr.length,
                lineNum = (lineNum =
                    len % n === 0 ? len / n : Math.floor(len / n + 1)),
                res = [];
            for (let i = 0; i < lineNum; i++) {
                let temp = Arr.slice(i * n, i * n + n);
                res.push(temp);
            }
            return res;
        }
    }
}
</script>
<style scoped>
.page{
    padding:56px 0;
    position: relative;
}
.pdfTitle{
    text-align: center;
    color:#000;
    font-size: 18px;
}
.pdfContent{
    line-height: 2;
    color: #000;
}
.orderGoodsTable{
    margin-top:24px;
    overflow: hidden;
}
.myTable{
    width: 100%;
    text-align: left;
    border-collapse:collapse;
    font-size: 12px;
}
.checkTitle{
    font-weight: bold;
    margin-bottom: 2px;
}
.text-center{
    text-align: center !important;
}
.width100{
    width:100px !important;
}
.myTable th,.myTable td{
    padding:0 10px;
}

.pagination{
    color:#666;
    font-size: 12px;
    text-align: center;
}
</style>
<style type="text/css" media="print">
@page {
    size: auto;
    margin: 0mm;
}
.always {
     page-break-after: always;
}
</style>
